package com.xsf.jieyou.business;


import com.xsf.jieyou.business.common.dto.ResponseStatus;

/**
 * 全局业务异常
 *
 * @author xsfno1
 * @version v1.0.0
 * @date 2020/3/10
 **/
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = -4235422592743789819L;

    private Boolean success;

    private Integer code;

    private String message;


    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public BusinessException() {
    }

    public BusinessException(ResponseStatus status) {
        this.success = false;
        this.code = status.code();
        this.message = status.message();
    }

    public BusinessException(ResponseStatus status, String message) {
        this.success = false;
        this.code = status.code();
        this.message = message;
    }
}
